package com.etoak.controller;


import com.etoak.commons.vo.ResultVO;
import com.etoak.entity.Area;
import com.etoak.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author et2108
 * @since 2021-12-11
 */
@RestController
@RequestMapping("/area")
public class AreaController {

    @Autowired
    AreaService areaService;

    /**
     *省市区列表接口
     * @param parentId
     * get /area?parentId=100000
     */
    @GetMapping
    public ResultVO getAreaList(@RequestParam(required = false,defaultValue = "100000") int parentId){
        List<Area> areaList = areaService.queryList(parentId);
        return ResultVO.success(areaList);
    }
}

